﻿CREATE TABLE [dbo].[Department] (
    [Id]           INT           IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
    [DName]        NVARCHAR (50) NULL,
    [ParentId]     INT           NULL,
    [CompanyId]    INT           NULL,
    [Sort]         VARCHAR (20)  NULL,
    [ProtectCount] INT           CONSTRAINT [DF_Department_ProtectCount] DEFAULT ((0)) NULL,
    [ProtectDays]  INT           CONSTRAINT [DF_Department_ProtectDays] DEFAULT ((0)) NULL,
    [ApplyCount]   INT           NULL,
    [bmbh]         VARCHAR (50)  NULL,
    [erp_bh]       VARCHAR (50)  CONSTRAINT [DF_Department_erp_bh] DEFAULT ('') NULL,
    [TrackCount]   INT           CONSTRAINT [DF_Department_TrackCount] DEFAULT ((0)) NULL,
    [TrackDays]    INT           CONSTRAINT [DF_Department_TrackDays] DEFAULT ((0)) NULL,
    [UserId]       VARCHAR (10)  CONSTRAINT [DF_Department_UserId] DEFAULT ('') NULL,
    [UserName]     NVARCHAR (30) CONSTRAINT [DF_Department_UserName] DEFAULT ('') NULL,
    [IP]           VARCHAR (15)  CONSTRAINT [DF_Department_IP] DEFAULT ('') NULL,
    [LastEditDate] DATETIME      NULL,
    CONSTRAINT [PK_Department_1] PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'部门编号（单位编号[01]+01,02,03）', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Department', @level2type = N'COLUMN', @level2name = N'bmbh';

